﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Com.FastSearch.Esp.Search.Navigation;
using Com.FastSearch.Esp.Search.Query;
using Com.FastSearch.Esp.Search.Result;
using Com.FastSearch.Esp.Search.View;
using Com.FastSearch.Esp.Search.View.Presentation;

namespace ESPWebPartsUnitTest.mock
{
    class SearchViewMock : ISearchView

    {
        private readonly string name;       
        private IResultSpecification resultSpecification;       

        public SearchViewMock(string name)
        {
            this.name = name;
            resultSpecification = new ResultSpecificationMock();
        }


        public string GetName()
        {
            return name;            
        }

        public string GetDescription()
        {
            return name + " mock view";            
        }

        public DateTime GetCreated()
        {
            return new DateTime();            
        }

        public DateTime GetLastSaved()
        {
            return new DateTime();                   
        }

        public IQueryResult Search(IQuery query)
        {            
            return new QueryResultMock(10, 100);            
        }

        public IQueryResult Search(IQuery query, Navigation nav)
        {
            return new QueryResultMock(10, 100);            
        }

        public string GetRequestParameters(IQuery query)
        {
            // todo:  
            return "";
        }

        public string GetRequestParameters(IQuery query, Navigation nav)
        {
            // todo:   
            return "";
        }

        public IContentSpecification GetContentSpecification()
        {
            return null;
        }

        public ISearchSpecification GetSearchSpecification()
        {
            return null;            
        }

        public IResultSpecification GetResultSpecification()
        {
            return resultSpecification;            
        }

        public IContentStructure GetContentStructure()
        {
            return null;            
        }

        public IPresentationSpecification GetPresentationSpecification()
        {
            return null;            
        }

        public void SetServerAddress(string hostname, int port, bool usePost, string certificateFile)
        {
            throw new NotImplementedException();
        }

        public void SetServerAddress(string hostname, int port, bool usePost, bool keepAlive, string certificateFile)
        {
            throw new NotImplementedException();
        }

        public void ClearServerAddress()
        {
            throw new NotImplementedException();
        }

        public void InitEngines(ArrayList e)
        {
            throw new NotImplementedException();
        }

        public string Name
        {
            get { return name; }
        }

        public string Description
        {
            get;
            set;
        }

        public DateTime Created
        {
            get;
            set;
        }

        public DateTime LastSaved
        {
            get;
            set;
        }

        public IContentSpecification ContentSpecification
        {
            get;
            set;
        }

        public ISearchSpecification SearchSpecification
        {
            get;
            set;
        }

        public IResultSpecification ResultSpecification
        {
            get { return resultSpecification; }
            
        }

        public IContentStructure ContentStructure
        {
            get;
            set;
        }

        public IPresentationSpecification PresentationSpecification
        {
            get;
            set;          
        }
    }
}
